(require-extension test)
(import test)

(test-begin "Section 1.3")

(load "ex1.29.scm")
(test 0.25 (integral (lambda (x) (* x x x)) 0 1 1000))
(test 4.0 (integral (lambda (x) (* x x x)) 0 2 1000))

(load "ex1.30.scm")
(test 55 (sum (lambda (x) x) 0 (lambda (x) (+ x 1)) 10))
(test 110 (sum (lambda (x) (* 2 x)) 0 (lambda (x) (+ x 1)) 10))

(load "ex1.32.scm")
(test 55 (accumulate + 0 (lambda (x) x) 0 (lambda (x) (+ x 1)) 10))
(test 55 (accumulate-iter + 0 (lambda (x) x) 0 (lambda (x) (+ x 1)) 10))

(load "ex1.33.scm")
(test 30 (filtered-accumulate + 0 even? (lambda (x) x) 0 (lambda (x) (+ x 1)) 10))
(test 25 (filtered-accumulate + 0 odd? (lambda (x) x) 0 (lambda (x) (+ x 1)) 9))



(test-end "Section 1.3")